<template>
  <div>
    <div class="tab-title-box">
      <span class="tab-item">在学课程</span>
    </div>
    <div class="tab-content-box">
      <div class="msg-ctx">
        <el-collapse accordion>
          <el-collapse-item class="msg-item" v-for="item in helpCenterList" :key="item.id" :name="item.id">
            <template v-slot:title>
              <div class="msg-item-title">
                <i class="el-icon el-icon-bell"></i>
                <h3>{{ item.title }}</h3>
              </div>
            </template>
            <div class="msg-item-ctx">
              {{ item.content }}
              <div class="msg-ctx-btn">
                <span>{{ item.createTime }}</span>
              </div>
            </div>
          </el-collapse-item>
        </el-collapse>
      </div>
    </div>
  </div>
</template>
<script>
import { getHelpCenterList } from "@/api/u/home"
import { mapState } from "vuex";
export default {
  name: "home-center",
  data() {
    return {
      helpCenterList: []
    };
  },
  computed: {
    ...mapState({ userInfo: (state) => state.user }),
  },
  created() {
    this.getHelpCenterList()
  },
  methods: {
    // 获取我的可成
    getHelpCenterList() {
      getHelpCenterList({}).then((res) => {
        this.helpCenterList = res.data;
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.tab-title-box {
  display: flex;
  height: 51px;
  line-height: 51px;
  border-bottom: 1px solid #e2e2e2;
  background: #ebeef5;
  .tab-item {
    margin-left: 40px;
    color: $theme-color-font;
    line-height: 51px;
    height: 52px;
    min-width: 65px;
    padding: 0 15px;
    text-align: center;
    cursor: pointer;
    font-size: 18px;
    float: left;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    border-top: 2px solid $theme-color-font;
    background: #fff;
  }
}
.tab-content-box {
  background: #fff;
  padding: 0 30px;
  .msg-ctx {
    padding: 0 20px;
    .msg-item {
      position: relative;
    }
    .msg-item-title {
      display: flex;
      align-items: center;
      margin: 0 20px;
      h3 {
        font-weight: initial;
      }
      .el-icon {
        width: 50px;
      }
      .msg-title-tag {
        position: absolute;
        right: 100px;
      }
    }
    .msg-item-ctx {
      text-align: left;
      padding: 20px 50px;
    }
    .msg-ctx-btn {
      margin: 10px 0 0 0;
      font-size: 12px;
      color: gray;
      text-align: right;
      span {
        margin-left: 10px;
      }
    }
  }
}
</style>